<template>
  <div class="dialong">
    <el-dialog
      type="primary"
      :close-on-press-escape="false"
      :modal-append-to-body="false"
      :close-on-click-modal="false"
      :width="widthD"
      :before-close="onCancel"
      v-bind="$attrs">
      <slot name="header"></slot>
      <slot />
      <div slot="footer" class="dialog-footer" v-if="showFooter">
        <el-button @click="onCancel" v-if="showCancel">取 消</el-button>
        <el-button type="primary" @click="onOk">{{confirmName}}</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
export default {
  props: {
    // title: {
    //   type: String,
    //   default: ""
    // },
    // visible: {
    //   type: Boolean,
    //   default: false
    // },
    showFooter:{
      type: Boolean,
      default: true
    },
    showCancel:{
      type: Boolean,
      default: true
    },
    width: {
      type: String,
      default: '56%'
    },
    onCancel: {
      type: Function,
      default: () => {}
    },
    onOk: {
      type: Function,
      default: () => {}
    },
    confirmName: {
      type: String,
      default: '确定'
    }
  },
  data() {
    return {
      widthD: this.width
    };
  },
  created(){
    let ismOrpc = this.$store.getters.ismOrpc
    if(!ismOrpc){
      this.widthD = '98%'
    }
  },
};
</script>
<style scoped>
.el-dialog__header{
  
}
</style>
